﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Model;

/// <summary>
/// Summary description for Logger
/// </summary>
public class Logger
{
    public static void WriteLog(NotarialServiceDataContext dc, LogOperationType type, int UserId, int? OrderId, int? StatusId)
    {
        WriteLog(dc, type, UserId, OrderId, StatusId, true);
    }

    public static void WriteLog(NotarialServiceDataContext dc, LogOperationType type, int UserId, int? OrderId, int? StatusId, bool submitChanges)
    {
        var entity = new Log { LogOperationId = (int)type, OrderId = OrderId, StatusId = StatusId, UserId = UserId };
        dc.Logs.InsertOnSubmit(entity);
        if (submitChanges)
            dc.SubmitChanges();
    }
}
